import request from "@/utils/request";
import { ParamsType } from "./types";

/**
 * 获取项目管理列表
 * @param data
 */
export function getProjectMagList(data: ParamsType) {
  return request({
    url: "api/v1/sysuser/project/project_page",
    method: "get",
    params: data,
  });
}

/**
 * 项目审核
 * @param data
 */
export function auditProject(id, data) {
  return request({
    url: "api/v1/sysuser/project/auditProject/" + id,
    method: "put",
    params: data,
  });
}

/**
 * 项目详情
 * @param data
 */
export function getProjectMagInfo(id: number) {
  return request({
    url: `api/v1/sysuser/project/${id}/projectform`,
    method: "get",
  });
}

/**
 * 获取项目班组列表
 */
export function getProjectTeamList(data: ParamsType) {
  return request({
    url: "/api/v1/sysuser/projectgroup/page",
    method: "get",
    params: data,
  });
}

/**
 * 根据班组ID 获取班组人员列表
 */
export function getProjectTeamMemberListByTeamId(id) {
  return request({
    url: "/api/v1/sysuser/projectgroupmember/getProjectGroupMemberByGroupId/" + id,
    method: "get",
  });
}

/**
 * 获取班组信息
 */
export function getProjectTeamInfo(id: number) {
  return request({
    url: `api/v1/sysuser/projectgroup/${id}/form`,
    method: "get",
  });
}

/**
 * 获取人员信息
 */
export function getPersonInfo(id: number) {
  return request({
    url: `api/v1/sysuser/person/${id}/form`,
    method: "get",
  });
}

/**
 * 获取考勤明细列表
 */
export function getAttendanceList(data: ParamsType) {
  return request({
    url: "/api/v1/sysuser/checkindetail/page",
    method: "get",
    params: data,
  });
}

/**
 * 获取考勤
 */
export function getAttendanceInfo(id: string, month: string) {
  return request({
    url: `/api/v1/sysuser/checkindetail/${id}/${month}/form`,
    method: "get",
  });
}

/**
 * 获取班组人员
 */
export function getGroupMember(data: ParamsType) {
  return request({
    url: "/api/v1/sysuser/projectgroupmember/page_projectGroupMembers",
    method: "get",
    params: data,
  });
}

/**
 * 新增考勤明细列表
 */
export function addAttendance(data) {
  return request({
    url: "/api/v1/sysuser/checkindetail/create",
    method: "post",
    data: data,
  });
}

/**
 * 修改考勤明细列表
 */
export function editAttendance(id, data) {
  return request({
    url: "/api/v1/sysuser/checkindetail/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 修改考勤明细列表
 */
export function deleteAttendance(id) {
  return request({
    url: "/api/v1/sysuser/checkindetail/" + id,
    method: "delete",
  });
}

/**
 * 获取项目班组下拉列表
 */
export function getProjectTeamPulldownList(projectId: number) {
  return request({
    url: "/api/v1/sysuser/projectgroup/getProjectCorps/" + projectId,
    method: "get",
  });
}
